import 'dart:convert' show json;

class Data {

  List<SaveArticleModel> models;

  Data.fromParams({this.models});

  factory Data(jsonStr) => jsonStr == null ? null : jsonStr is String ? new Data.fromJson(json.decode(jsonStr)) : new Data.fromJson(jsonStr);

  Data.fromJson(jsonRes) {
    models = jsonRes['models'] == null ? null : [];

    for (var modelsItem in models == null ? [] : jsonRes['models']){
      models.add(modelsItem == null ? null : new SaveArticleModel.fromJson(modelsItem));
    }
  }

  @override
  String toString() {
    return '{"models": $models}';
  }
}

class SaveArticleModel {

  String createdAt;
  String objectId;
  String title;
  String updatedAt;
  String url;

  SaveArticleModel.fromParams({this.createdAt, this.objectId, this.title, this.updatedAt, this.url});

  SaveArticleModel.fromJson(jsonRes) {
    createdAt = jsonRes['createdAt'];
    objectId = jsonRes['objectId'];
    title = jsonRes['title'];
    updatedAt = jsonRes['updatedAt'];
    url = jsonRes['url'];
  }

  @override
  String toString() {
    return '{"createdAt": ${createdAt != null?'${json.encode(createdAt)}':'null'},"objectId": ${objectId != null?'${json.encode(objectId)}':'null'},"title": ${title != null?'${json.encode(title)}':'null'},"updatedAt": ${updatedAt != null?'${json.encode(updatedAt)}':'null'},"url": ${url != null?'${json.encode(url)}':'null'}}';
  }
}

